package commonlang3;

import org.apache.commons.lang3.concurrent.BasicThreadFactory;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;

public class CommonLang3ThreadPoolFactory {

    private CommonLang3ThreadPoolFactory() {
    }

    private static class ThreadPoolHolder {
        private static final ExecutorService THREAD_POOL = new ScheduledThreadPoolExecutor(5,
                new BasicThreadFactory.Builder().namingPattern("common-lang3-pool-%d").daemon(false).build());
    }

    public static ExecutorService getThreadPool() {
        return CommonLang3ThreadPoolFactory.ThreadPoolHolder.THREAD_POOL;
    }

}
